package com.dd.admin.business.member.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dd.admin.common.model.PageFactory;
import com.dd.admin.business.member.entity.Member;
import com.dd.admin.business.member.mapper.MemberMapper;
import com.dd.admin.business.member.service.MemberService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.dd.admin.business.member.domain.MemberVo;
import com.dd.admin.business.member.domain.MemberDto;
import java.util.List;

/**
 * <p>
 * 会员 服务实现类
 * </p>
 *
 * @author 727869402@qq.com
 * @since 2024-05-21
 */
@Service
public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> implements MemberService {

    @Override
    public IPage<MemberVo> selectMemberPage(MemberDto memberDto) {
        Page page = PageFactory.defaultPage();
        return baseMapper.selectMemberPage(page,memberDto);
    }

    @Override
    public List<MemberVo> selectMemberList(MemberDto memberDto) {
        return baseMapper.selectMemberList(memberDto);
    }

    @Override
    public Integer selectMemberCount(String shopId) {
        LambdaQueryWrapper<Member> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Member::getShopId, shopId);
        return baseMapper.selectCount(queryWrapper);
    }
}
